package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

import com.example.demo.servlet.SecondServlet;
import com.example.domo.filter.SecondFilter;

@SpringBootApplication
public class SpringbootFilter2Application {

	public static void main(String[] args) {
		SpringApplication.run(SpringbootFilter2Application.class, args);
	}
	@Bean
	public static ServletRegistrationBean<SecondServlet> getServlet(){
		ServletRegistrationBean<SecondServlet> secondServlet = new ServletRegistrationBean<>(new SecondServlet());
		secondServlet.addUrlMappings("/second");
		return secondServlet;
	}
	@Bean
	public static FilterRegistrationBean<SecondFilter> getFilter() {
		FilterRegistrationBean<SecondFilter> secondFilter = new FilterRegistrationBean<>(new SecondFilter());
		secondFilter.addUrlPatterns("/second");
		return secondFilter;
	}

}
